/**
 *
 */
package com.edooschool.webpay.service;

import com.edooschool.webpay.entity.PayEvent;
import com.edooschool.webpay.entity.PaymentContext;
import com.edooschool.webpay.entity.prepare.PrepareRequest;

/**
 * @author downpour
 *
 */
public interface PaymentService {

    /**
     * Create or refresh payment context
     * 
     * @param prepareRequest
     * @return
     */
    public PaymentContext prepareContext(PrepareRequest prepareRequest);

    /**
     * load payment context by outTradeNo
     * 
     * @param outTradeNo
     * @return
     */
    public PaymentContext loadContext(String outTradeNo);
    
    /**
     * finish payment context by paid {@link PaymentContext}
     * 
     * @param paymentContext
     * @param transactionCode
     * @return
     */
    public boolean paid(PaymentContext paymentContext, String transactionCode);

    /**
     * Create payment round
     * 
     * @param requestNo
     * @param orderNo
     * @param event
     * @param clientIp
     */
    public void createRound(String requestNo, String orderNo, PayEvent event, String clientIp);

}
